import { OrdersData, Top10Data, TurnoverData, UserData } from "@/types/statistics"
import request from "@/utils/request"
interface StatisticsParams {
  begin: string
  end: string
}
/**
 * 营业额统计
 * @param params 
 * @returns 
 */
export const getAdminTurnoverStatisticsAPI = (params: StatisticsParams) => {
  return request<TurnoverData>({
    method: 'GET',
    url: '/admin/report/turnoverStatistics',
    params: { ...params }
  })
}
/**
 * 用户统计
 * @param params 
 * @returns 
 */
export const getAdminUserStatisticsAPI = (params: StatisticsParams) => {
  return request<UserData>({
    method: 'GET',
    url: '/admin/report/userStatistics',
    params: { ...params }
  })
}
/**
 * 订单统计
 * @param params 
 * @returns 
 */
export const getAdminOrdersStatisticsAPI = (params: StatisticsParams) => {
  return request<OrdersData>({
    method: 'GET',
    url: '/admin/report/ordersStatistics',
    params: { ...params }
  })
}
/**
 * 销量前10
 * @param params 
 * @returns 
 */
export const getAdminTopStatisticsAPI = (params: StatisticsParams) => {
  return request<Top10Data>({
    method: 'GET',
    url: '/admin/report/top10',
    params: { ...params }
  })
}
/**
 * 导出Excel报表接口
 * @returns 
 */
export const getExport = () => {
  return request({
    method: 'GET',
    url: '/admin/report/export',
    responseType: "blob"
  })
}